DEFINE VARIABLE issamt AS DECIMAL.
DEFINE VARIABLE isstotal AS DECIMAL.

FOR EACH ptp_det NO-LOCK WHERE ptp__dec02 = 0 AND ptp__chr01 ="C" AND ptp_part BEGINS ""
                           AND ptp_pm_code = "P" AND ptp_site BEGINS "510",
    EACH pt_mstr NO-LOCK WHERE pt_part = ptp_part:

    issamt = 0.
    FOR EACH tr_hist NO-LOCK WHERE tr_type = "ISS-WO" AND tr_effdate <= DATE("05/04/01") AND tr_part = pt_part:
             issamt = issamt + tr_gl_amt.
             isstotal = isstotal + tr_gl_amt.
    END.

    DISP ptp_part ptp_site ptp__chr01 ptp_pm_code ptp__dec02 issamt isstotal * 0.17 pt_added pt_desc1
         
        WITH WIDTH 200.
END.
